<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="java.net.*"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!-- 登录 注册 我的订单 -->
<div class="container-fluid">
	<div class="col-md-4">
		<img src="${pageContext.request.contextPath}/img/headerLogo.png" />
	</div>
	
	<div class="col-md-2">
		<span>&nbsp;手机端访问</span>
		<div id="qrcode">
		</div>
	</div>
	
	<div class="col-md-3">
		<div>
			<p></p>
			<span>预&nbsp;&nbsp;定&nbsp;&nbsp;热&nbsp;&nbsp;线:</span><br>
			<span>0552-6666-8888</span><br>
			<p></p>
		</div>
		<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=1135872138&site=qq&menu=yes">
		<img border="0" src="http://wpa.qq.com/pa?p=2:1135872138:51" alt="点击这里给我发消息" title="点击这里给我发消息"/>
		</a>
	</div>

	<%
     InetAddress addr = InetAddress.getLocalHost();
     String ip=addr.getHostAddress();//获得本机IP
     ip+=":8080/HotelManagementSystem/index.jsp";
     ip="http://"+ip;
	%>
	<script>
	 $("#qrcode").qrcode({
         width: 80,
         height:80,
         text: "<%=ip%>"
    });
  	</script>
  	
  	<script>
			$(function() {
				$("#tags").autocomplete({
					source: function( request, response ) {
						$.ajax({
							url:"${pageContext.request.contextPath}/project/autoSearchWord.action",
							async:true,
							type:"POST",
							data:{"search":request.term},
							success:function(availableTags){
								response(availableTags);
							},
							dataType:"json"
						});
					}
				});
			});
		</script>
  	
  	
  
	<div class="col-md-3" style="padding-top:20px">
		<ol class="list-inline">
			<c:if test="${empty user}">
				<li><a class="btn btn-default" href="${pageContext.request.contextPath}/login.jsp" role="button">登录</a></li>
				<li><a class="btn btn-default" href="${pageContext.request.contextPath}/register.jsp" role="button">注册</a></li>
			</c:if>
			<c:if test="${!empty user}">
				<li>欢迎您:${user.username }</li>
				<li><a class="btn btn-default" href="${pageContext.request.contextPath}/login/cancellation.action" role="button">退出</a></li>
			</c:if>
			<li><a class="btn btn-default" href="my_order.jsp" role="button">我的订单</a></li>
		</ol>
	</div>
</div>

<!-- 导航条 -->
<div class="container-fluid">
	<nav class="navbar navbar-inverse">
		<div class="container-fluid">
			<!-- Brand and toggle get grouped for better mobile display -->
			<div class="navbar-header">
				<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
					<span class="sr-only">Toggle navigation</span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</button>
				<a class="navbar-brand" href="${pageContext.request.contextPath}/index.jsp">首页</a>
			</div>

			<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
				<ul class="nav navbar-nav" id="categoryUl">
					
				</ul>
				
				<form class="navbar-form navbar-right" role="search">
					<div class="form-group">
						<div class="ui-widget">
						<label for="tags"></label>
						<input type="text" id="tags" class="form-control" placeholder="搜索">
						</div>
					</div>
					<button type="submit" class="btn btn-default">提交</button>
				</form>
			</div>
		</div>
		
		<script type="text/javascript">
			$(function(){
				var content = "";
				$.post(
					"${pageContext.request.contextPath}/project/getProjectName.action",
					function(data){
						for(var i=0;i<data.length;i++){
							content+="<li><a href='${pageContext.request.contextPath}/project/getProjectCategory.action?pid="+data[i].project_id+"'>"+data[i].project_name+"</a></li>";
						}
						$("#categoryUl").html(content);
					},
					"json"
				);
			});
		</script>
		
	</nav>
</div>